System.Gadget.settingsUI = "Settings.html";

var interval = getInterval();
var timer = interval * 60;

function getInterval()
{
	var cd = System.Gadget.Settings.read("Interval");
	if (cd != "")
		return cd;
	else
		return 15;
}

function f()
{
	var tick = m();
	
	document.getElementById('puma').innerHTML = tick;
	setTimeout("f()", 1000);
}

function m()   
{   
	timer--;
	if (timer == 0)
	{
		System.Sound.playSound('alarm.wav');
		timer = interval * 60;
	}
	
	return timer;
}

function loadInterval()
{
	var tmp = getInterval();
	if (tmp != interval)
	{
		interval = tmp;
		timer = interval * 60;
	}
	
	setTimeout("loadInterval()", 2000);
}
